﻿using System.Windows.Forms;

namespace DimsMapper
{
    public partial class ProgressForm : Form
    {
        int value;

        public ProgressForm(string text, int steps)
        {
            InitializeComponent();
            progressBar.Maximum = (steps / 10) + 1;
            label.Text = text;
            Application.DoEvents();
        }

        public void SetProgressText(string text, int steps)
        {
            value = 0;
            progressBar.Value = 0;
            progressBar.Maximum = (steps / 10) + 1;
            label.Text = text;
            Application.DoEvents();
        }

        public void ProgressStep()
        {
            if (++value % 10 == 0) {
                progressBar.Value++;
                Application.DoEvents();
            }
        }

        public void ProgressStepTile()
        {
            if (++value % 100 == 0) {
                progressBar.Value++;
                Application.DoEvents();
            }
        }
    }
}
